
// export default {
//     totalCount(state) {
//         //求所有的总商品数量

//         return  state.cartFoods.reduce((pre, current) => pre + current.count, 0)

//     },

//     totalPrice(state) {
//         return  state.cartFoods.reduce((pre, current) => pre + current.count*current.price, 0)
//     }


// }

export default{
  totalCount(state){
    //计算商品总数量reduce(回调函数(累加器,当前值),开始数)
   return state.cartFoods.reduce((pre,current)=>pre+current.count,0)
  },
  totalPrice(state){
   return state.cartFoods.reduce((pre,current)=>pre+current.count*current.price,0)
  }
  }
